package com.thinkingcoder.tcgateway.filter;

import org.springframework.http.server.reactive.ServerHttpRequest;
import org.springframework.stereotype.Component;
import org.springframework.web.server.ServerWebExchange;

import lombok.extern.slf4j.Slf4j;
import reactor.core.publisher.Mono;

@Slf4j
@Component
public class DemoFilter implements GatewayFilter {

    @Override
    public Mono<Void> filter(ServerWebExchange exchange) {
        ServerHttpRequest request = exchange.getRequest();
        System.out.println(" ===>>> filters: demo filter ...");
        request.getHeaders().toSingleValueMap().forEach((k, v) -> {
            System.out.println("H_Key : " + k + ", H_Value : " + v);
        });
        return Mono.empty();
    }

}
